#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author： 青城子
# datetime： 2021/9/19 22:24 
# ide： PyCharm

from django import forms

from apps.app01 import models
from apps.app01.forms.widgets import ColorRadioSelect
from .bootstrap import BootStrapForm


class ItModelForm(BootStrapForm, forms.ModelForm):
    bootstrap_class_exclude = ['color']

    class Meta:
        model = models.It
        fields = "__all__"
        widgets = {
            "color": ColorRadioSelect(attrs={"class": "color-radio"}),
            "it_start_time": forms.DateTimeInput(attrs={"autocomplete": "off"}),
            "it_end_time": forms.DateTimeInput(attrs={"autocomplete": "off"}),
        }


class ApiModelForm(BootStrapForm, forms.ModelForm):
    """
    用例表
    """

    api_desc = forms.CharField(
        label="用例描述",
        required=False,
        widget=forms.Textarea()
    )

    class Meta:
        model = models.Api
        fields = "__all__"
        exclude = ["api_run_status", "api_run_time", "api_pass_status", "api_report", "api_sub_it"]
